Downloading satelite imagery
Download the data from Sentinel Hub Playground.
Extract the dates from the filenames
dates <- tibble(file_paths = fs::dir_ls("data/2019-12-13-raster-time-series-animation_data/vir/", glob = "*.jpg")) %>%
mutate(dates = as_date(str_extract(string = file_paths, pattern = regex(" [0-9]+-[0-9]+-[0-9]+"))))
dates## # A tibble: 5 x 2
## file_paths dates
## <fs::path> <date>
## 1 data/2019-12-13-raster-time-series-animation_data/vir/Sentinel-2 L~ 2015-07-28
## 2 data/2019-12-13-raster-time-series-animation_data/vir/Sentinel-2 L~ 2016-07-02
## 3 data/2019-12-13-raster-time-series-animation_data/vir/Sentinel-2 L~ 2017-07-02
## 4 data/2019-12-13-raster-time-series-animation_data/vir/Sentinel-2 L~ 2018-07-07
## 5 data/2019-12-13-raster-time-series-animation_data/vir/Sentinel-2 L~ 2019-07-17
Make a gif out of the downloaded satelite imagery.
Import the files and create a gif utilizing “magick” for image processing.
Steps:
- List of filenames with
dir_ls - Read the images with
image_readand join themimage_join - name the gif by using
glueand dates$dates vector - last step animate the gif at a frame rate of 0.5.
vir_gif <- dir_ls("data/2019-12-13-raster-time-series-animation_data/vir/", glob = "*.jpg") %>%
map(image_read) %>%
image_join() %>%
image_annotate(glue("Island of Vir: {dates$dates}"), location = "+10+10", size = 20, color = "white") %>%
image_animate(fps=0.5) %>%
image_write("data/2019-12-13-raster-time-series-animation_data/outputs/vir2015_2019.gif")